/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package SensorCheckersImpl;

import SensorCheckerInterface.ISensorChecker;
import DTO.SensorDTO;
import java.util.HashMap;

/**
 *
 * @author Administrator
 */
public class ManagerSensorChecker {

    private HashMap<String, ISensorChecker> mapISC = new HashMap<String, ISensorChecker>();

    public final void installNewSensorChecker(ISensorChecker isc) {
        mapISC.put(isc.getSensorCheckerSign(), isc);
    }

    public final void unInstallSensorChecker(String sign) {
        mapISC.remove(sign);
    }    

    public boolean checkBoundary(SensorDTO sdto) {
        ISensorChecker isc = null;
        try {
            isc = mapISC.get(sdto.getSensorSign());
        } catch (Exception e) {
            System.out.println("NOT FOUND SENSOR CHECKER");
            return true;// khong tim thay sensor checker thi khong kiem tra, cho qua du lieu nay
        }        
        return isc.CheckSensor(sdto);
    }

    public HashMap<String, ISensorChecker> getMapISC() {
        return mapISC;
    }

    public void setMapISC(HashMap<String, ISensorChecker> mapISC) {
        this.mapISC = mapISC;
    }
    
    
}
